
public class ProcessControlBlock 
{
	private int my_next_step;
	private String my_state;			
	private AbstractProcess my_process;
	private IODevice my_device;	
	
	public ProcessControlBlock (final String the_state, final AbstractProcess the_process)
	{
		my_next_step = 0;
		my_state = the_state;
		my_process = the_process;
		
		if (getProcessPriority() != -1 && getProcessId() == 0)
		{
			my_state = "RUNNING";
		}
		else
		{
			my_state = "RUNNABLE";
		}
		
		my_process.generateInstructions();
	}
	
	public IODevice getDevice()
	{
		return my_device;  
	}
	
	public String getProcessName()
	{
		return my_process.getName();
	}
	
	public void setDevice(final IODevice the_device)
	{
		my_device = the_device;
	}
	
	public int getProcessPriority()
	{
		return my_process.getPriority();
	}
	
	public int getProcessId()
	{
		return my_process.getId();
	}
	
	public int getNextStep()
	{
		return my_next_step;
	}
	/**
	 * Program Counter.
	 * @param the_next_step counting.
	 */
	public void setNextStep(final int the_next_step)
	{
		my_next_step = the_next_step;
	}
	
	public AbstractProcess getProcess()
	{
		return my_process;
	}
	
	public synchronized String getProcessState()
	{
		return my_state;
	}
	
	public synchronized void setProcessState(final String the_state)
	{
		my_state = the_state;
	}
}
